package org.shoy.core.model;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by Administrator on 2016/4/4.
 */
@Entity
@Table(name = "wiki_version")
public class WikiVersionEntity {
    private Integer id;
    private String wiki;
    private String version;
    private Integer versionCode;
    private String description;
    private Timestamp creation;

    @Id
    @Column(name = "id", nullable = false)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "wiki", nullable = false, length = 64)
    public String getWiki() {
        return wiki;
    }

    public void setWiki(String wiki) {
        this.wiki = wiki;
    }

    @Basic
    @Column(name = "version", nullable = false, length = 32)
    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    @Basic
    @Column(name = "varsion_code", nullable = false)
    public Integer getVarsionCode() {
        return versionCode;
    }

    public void setVarsionCode(Integer varsionCode) {
        this.versionCode = varsionCode;
    }

    @Basic
    @Column(name = "description", nullable = true, length = 512)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Basic
    @Column(name = "creation", nullable = false)
    public Timestamp getCreation() {
        return creation;
    }

    public void setCreation(Timestamp creation) {
        this.creation = creation;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        WikiVersionEntity that = (WikiVersionEntity) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (wiki != null ? !wiki.equals(that.wiki) : that.wiki != null) return false;
        if (version != null ? !version.equals(that.version) : that.version != null) return false;
        if (versionCode != null ? !versionCode.equals(that.versionCode) : that.versionCode != null) return false;
        if (description != null ? !description.equals(that.description) : that.description != null) return false;
        if (creation != null ? !creation.equals(that.creation) : that.creation != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (wiki != null ? wiki.hashCode() : 0);
        result = 31 * result + (version != null ? version.hashCode() : 0);
        result = 31 * result + (versionCode != null ? versionCode.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (creation != null ? creation.hashCode() : 0);
        return result;
    }
}
